<template>
  <van-slider v-bind="$attrs" v-model="silderValue" />
</template>

<script setup lang="ts">
import { computed } from 'vue'

export interface SliderProps {
  modelValue: number | [number, number]
}

const props = withDefaults(defineProps<SliderProps>(), {
  modelValue: 0
})

const emits = defineEmits({
  'update:modelValue': (val) => !!val
})

const silderValue = computed({
  get: () => {
    return props.modelValue
  },
  set: (val) => {
    emits('update:modelValue', val)
  }
})

defineOptions({
  name: 'VSlider'
})
</script>
